package cn.njbdqn;

/**
 * @author HX
 * @Description
 * @date 2019/11/29
 */
public class Book {
     private int id;
     private String name;
     private String author;
     private double price;


    public Book(int id, String name, String author, double price) {
        this.id = id;
        this.name = name;
        this.author = author;
        this.price = price;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "图书信息：\t" + "帐号：" + id +
                "\t 书名：" + name  +
                "\t 作者：" + author +
                "\t 价格" + price ;
    }

    @Override
    public boolean equals(Object obj) {
       if (obj==null){
           return false;
       }
       if (obj instanceof Book){
            Book b=(Book) obj;
            if (b.id==this.id && b.name.equals(this.name)){
                return true;
            }
       }
       return false;
    }
}
